package main

import (
	"fmt"
	"reflect"
)

type A struct {
	s string
}

// 不建议使用reflect.DeepEqual来比较, 使用google cmp更好
// https://stackoverflow.com/questions/24534072/how-to-compare-struct-slice-map-are-equal

// 如何比较struct nil
//https://stackoverflow.com/questions/28447297/how-to-check-for-an-empty-struct
func main() {

	a1 := A{s: "abc"}
	a2 := A{s: "abc"}
	if reflect.DeepEqual(a1, a2) {
		fmt.Println(a1, "==", a2)
	}

	b1 := []int{1, 2}
	b2 := []int{1, 2}
	if reflect.DeepEqual(b1, b2) {
		fmt.Println(b1, "==", b2)
	}

	c1 := map[string]int{"a": 1, "b": 2}
	c2 := map[string]int{"a": 1, "b": 2}
	if reflect.DeepEqual(c1, c2) {
		fmt.Println(c1, "==", c2)
	}
}
